import os

def write_serial_file(s):
    '''write file to be imported in the website to generate cool graphs'''
    f = open('pykeylogger-1.2.1/logs/aggreg.txt', 'w+')
    for c in s['keycount'].keys():
        f.write(c+'___'+str(s['keycount'][c]['ratio'])+'\n')
    f.write('***\n')

    for c in s['processes'].keys():
        f.write(c+'___'+str(s['processes'][c]['ratio'])+'\n')
    f.write('***\n')

    for c in s['websites'].keys():
        f.write(c+'___'+str(s['websites'][c]['ratio'])+'\n')
    f.write('***\n')

    for c in s['keysum_history']:
        f.write(c[0] + '___' + str(c[1]) + '\n')
    f.write('***\n')

    for c in s['achievements']:
        f.write(c[0]+'___'+c[1] + '\n')
    f.write('***\n')

    f.close()
    return
